<?php
$page_title = "Deconectare - fifaonline.ro";
include_once("top.php");
?>
<?php
//Daca nu exista o variabila first_name, redirectioneaza utilizatorul
if(!isset($_SESSION["first_name"]))
{
	$url = 'http://' . $_SERVER['HTTP_HOST'] . dirname($_SERVER['PHP_SELF']);
	//Verifica existenta unui caracter slash
	if(substr($url, -1) == '/' OR substr($url, -1) == '\\')
	{
		$url = substr($url, 0, -1); //Elimina caracterul slash
	}
	//Adauga pagina
	$url .= '/index.php';
	
	ob_end_clean(); //Sterge bufferul
	header("Location:$url");
	exit();
}
else
{
	
	require_once("/includes/mysql_connect.php");
	$query = "UPDATE users SET logged_in=0 WHERE email={$_SESSION['email']}";
	$result = mysql_query($query);
	$_SESSION = array();
	session_destroy();
	setcookie(session_name(), '', time() -300, '/', '', 0);
}

echo "<h3>Esti deconectat</h3>";
?>
<?php
include_once("end.php");
?>